<?php

require_once("../Scripts/authenticate.php"); 
require_once("../Scripts/DatabaseConnect.php"); 

?>
<html>
  <head>
    <!--Load the AJAX API-->
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">

      // Load the Visualization API and the piechart package.
      google.load('visualization', '1.0', {'packages':['corechart']});

      // Set a callback to run when the Google Visualization API is loaded.
      google.setOnLoadCallback(drawChart);

      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
      function drawChart() {
	
        // Create the data table.
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Topping');
        data.addColumn('number', 'Shares');
        data.addRows([
          ['Shares', 3],
          
        ]);

        // Set chart options
        var options = {'title':'Volume of Shares Purchased',
                       'width':400,
                       'height':300};

        // Instantiate and draw our chart, passing in some options.
        var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>

  <body>
  
      <h2>Volume of Shares</h2>
<?php
        if (isset($_SESSION['msgG'])) {
	echo "<p style='color:green'>".$_SESSION['msgG']."</p>"; 
	echo '<input type="button" name="logout" value="Logout" onClick="location.href=\'../Scripts/Logout.php\'"/>'; 
}
	
?>  
 <?php
			  	$con=Remoteconnect();
				if($con==null){
					$con=Localconnect();	
				}
			  $sql="SELECT * FROM `userportfolio` WHERE Email ='".$_SESSION['email']."'";
			  
			 
			  $result = mysqli_query($con,"SELECT * FROM `userportfolio` WHERE Email ='".$_SESSION['email']."'");
			  while($row = mysqli_fetch_array($result)) {
					$Symbol=$row['Symbol'];
					$Type= $row['Type'];
					$Date= $row['Date'];
					$Shares = $row['Shares'];
					$Price= $row['Price'];
					$Commission= $row['Commission'];
					$Notes =$row['Notes'];
					$CashValue=$row['CashValue'];
					
					echo"Symbol: $Symbol<br>";
					echo"Type: $Type<br>";
					echo"Date: $Date<br>";
					echo"Shares: $Shares<br>";
					echo"Price: $Price<br>";
					echo"Commission: $Commission<br>";
					echo"Cash Value: $CashValue<br>";
					echo"Notes: $Notes<br>";
					echo"_________________________<br>";
					
					
					
					
					

				}
			  	
				
				
				mysqli_close($con);
			
			  
			  ?>
    <!--Div that will hold the pie chart-->
    <div id="chart_div"></div>
  </body>
</html>